home *** CD-ROM | disk | FTP | other *** search
/ The Sunday Times: The Month 2003 December / The Sunday Times - The Month 2003-12.iso / mac / The Month DEC 03 / engine / modules / preview_listen_releases.swf / scripts / frame_1 / DoAction_2.as next >
Text File  |  2003-11-10  |  4KB  |  108 lines

  1. function PlayList()
  2. {
  3.    this.arrFilePaths = new Array();
  4.    this.arrTracks = new Array();
  5.    this.arrFilePaths[0] = "blue";
  6.    this.arrTracks[0] = ["taste_it","bubblin","rock_the_night","back_it_up","when_summers_gone","walk_away"];
  7.    this.arrFilePaths[1] = "chemical";
  8.    this.arrTracks[1] = ["block_rockin_beats","hey_boy_hey_girl","leave_home","let_forever_be","the_golden_path","get_yourself_high_feat"];
  9.    this.arrFilePaths[2] = "furtado";
  10.    this.arrTracks[2] = ["fresh_off_the_boat","powerless","explode","try"];
  11.    this.arrFilePaths[3] = "jackson";
  12.    this.arrTracks[3] = ["rock_with_you","billie_jean","smooth_criminal","earth_song","blood_on_the_dance_floor","human_nature"];
  13.    this.arrFilePaths[4] = "mayer";
  14.    this.arrTracks[4] = ["clarity","new_deep","come_back_to_bed","wheel","daughters","bigger_than_my_body"];
  15.    this.arrFilePaths[5] = "minogue";
  16.    this.arrTracks[5] = ["slow","still_standing","promises","sweet_music","chocolate","i_feel_for_you"];
  17.    this.arrFilePaths[6] = "springsteen";
  18.    this.arrTracks[6] = ["hungry_heart","thunder_road","born_to_run","the_river","the_rising","streets_of_philadelphia"];
  19.    this.arrFilePaths[7] = "suede";
  20.    this.arrTracks[7] = ["beautiful_ones","animal_nitrate","wild_ones","stay_together","shes_in_fashion","saturday_night"];
  21.    this.arrFilePaths[8] = "valance";
  22.    this.arrTracks[8] = ["hypnotic","state_of_mind","desire","curious","roll_over","tongue_tied"];
  23.    this.numberOfArtists = this.arrTracks.length;
  24.    this.currArtistId = 0;
  25.    this.currTrackId = 0;
  26.    this.firstPlay = true;
  27.    this.lastTrack = null;
  28.    this.playTrack = function()
  29.    {
  30.       var trackToPlay = this.arrTracks[this.currArtistId][this.currTrackId];
  31.       var fileToLoad = Tardis.ASSETS_FOLDER + "audio/music/" + this.arrFilePaths[this.currArtistId] + "/" + trackToPlay + ".mp3";
  32.       sndObj.stop();
  33.       delete sndObj;
  34.       soundClip_mc.removeMovieClip();
  35.       createEmptyMovieClip("soundClip_mc",++depth);
  36.       sndObj = new Sound(soundClip_mc);
  37.       sndObj.onLoad = function()
  38.       {
  39.          this.start();
  40.       };
  41.       sndObj.loadSound(fileToLoad,false);
  42.       this.currSound = sndObj;
  43.       this.monitorID = setInterval(this,"monitorTrackPosition",40);
  44.       mc_images.doOver(this.currArtistId);
  45.       autoPlayingTracks = true;
  46.       var mcToLolite = this.lastTrack;
  47.       var mcToHilite = Tardis.template.mcTR["mc_txt_" + this.currArtistId];
  48.       Tardis.template.mcTR.doPlaylistTrackHilite(mcToHilite,mcToLolite);
  49.       this.lastTrack = mcToHilite;
  50.       this.firstPlay = false;
  51.    };
  52.    this.playNextTrack = function()
  53.    {
  54.       this.currTrackId = this.currTrackId + 1;
  55.       if(this.currTrackId == this.arrTracks[this.currArtistId].length)
  56.       {
  57.          this.currTrackId = 0;
  58.          this.currArtistId = this.currArtistId + 1;
  59.          while(this.arrFilePaths[this.currArtistId] == "")
  60.          {
  61.             this.currArtistId = this.currArtistId + 1;
  62.          }
  63.          if(this.currArtistId == this.numberOfArtists)
  64.          {
  65.             this.currArtistId = 0;
  66.          }
  67.       }
  68.       this.playTrack();
  69.    };
  70.    this.monitorTrackPosition = function()
  71.    {
  72.       if(this.currSound && this.currSound.duration)
  73.       {
  74.          if(this.currSound.position >= this.currSound.duration)
  75.          {
  76.             clearInterval(this.monitorID);
  77.             this.currSound.stop();
  78.             this.currSound = 0;
  79.             this.playNextTrack();
  80.          }
  81.       }
  82.    };
  83.    this.stopTrack = function()
  84.    {
  85.       clearInterval(this.monitorID);
  86.       autoPlayingTracks = false;
  87.       Tardis.template.mcTR.txtOut(Tardis.template.mcTR["mc_txt_" + this.currArtistId]);
  88.       this.clearUp();
  89.    };
  90.    this.clearUp = function()
  91.    {
  92.       clearInterval(this.monitorID);
  93.       sndObj.stop();
  94.       delete sndObj;
  95.       delete this.currSound;
  96.    };
  97.    this.playTrack();
  98. }
  99. function initAutoplay()
  100. {
  101.    myPlayList = new PlayList();
  102. }
  103. function stopAutoplay()
  104. {
  105.    myPlayList.stopTrack();
  106. }
  107. autoPlayingTracks = false;
  108.